import request from '@/utils/request'

// 查询工作流列表
export function listWorkflow(query) {
  return request({
    url: '/work-flow/workflow/list',
    method: 'get',
    params: query
  })
}

// 查询工作流详细
export function getWorkflow(id) {
  return request({
    url: '/work-flow/workflow/' + id,
    method: 'get'
  })
}

// 新增工作流
export function addWorkflow(data) {
  return request({
    url: '/work-flow/workflow',
    method: 'post',
    data: data
  })
}

// 修改工作流
export function updateWorkflow(data) {
  return request({
    url: '/work-flow/workflow',
    method: 'put',
    data: data
  })
}

// 删除工作流
export function delWorkflow(id) {
  return request({
    url: '/work-flow/workflow/' + id,
    method: 'delete'
  })
}

export function auditWorkFlow(data, taskId, skipType, message, nodeCode, flowStatus) {
  return request({
    url: '/work-flow/workflow/audit?taskId=' + taskId + '&skipType=' + skipType + '&message=' + message
      + '&nodeCode=' + nodeCode + '&flowStatus=' + flowStatus,
    data: data,
    method: 'post'
  })
}

export function serviceMap(serviceName){
  return request(({
    url:'/work-flow/workflow/service/map?service='+serviceName,
    method:'get'
  }))
}
